const mysql=require('mysql')
const {MYSQL_CONF}=require('../conf/db')
const con=mysql.createConnection(MYSQL_CONF)
con.connect()

function exec(sql){
    const promise=new Promise((resolve,reject)=>{
        con.query(sql,(error,data)=>{
            if (error) {
                reject(error)
                return
            }
            resolve(data)
        })
    })
    return promise
}
module.exports={exec}